package com.richinfo.provider.controller;



import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.richinfo.provider.entity.User;


/**
* Created by WangXJ
* 2018-10-30 11:20
*/
@RestController
public class HelloController {
	
	private final Logger logger = LoggerFactory.getLogger(HelloController.class);
	
	@GetMapping("/hello")
	public String sayHello() throws InterruptedException {
		logger.info("=== sayHello ===");
		return "Hello World";
	}
	
	@GetMapping("/hello1")
	public String sayHello(@RequestParam String name) {
		return "Hello" + name;
	}
	
	@GetMapping("/hello2")
	public User sayHello(@RequestHeader String name,@RequestHeader Integer age) {
		return new User(name,age);
	}
	
	@PostMapping("/hello3")
	public String sayHello(@RequestBody User user) {
		return "Hello" + user.getName() + "," +user.getAge();
	}
}
